#!/usr/bin/env python
#-*- coding: utf-8 -*-
#__author__:vincentlc
#time: 16/5/31 : 17:16

'''
Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
'''


# Definition for a binary tree node.
class TreeNode(object):
    def __init__(self, x):
        self.val = x
        self.left = None
        self.right = None

class Solution(object):
    def minDepth(self, root):
        """
        :type root: TreeNode
        :rtype: int
        """

    def BST(self,root,val):
        n_val = val+root.val
        if root.left != None:
            val_1 = self.BST(root.left,n_val)

        if root.right != None:
            val_2 = self.BST(root.right,n_val)

        if root.left == None and root.right == None:
            return n_val